package com.manli.api.service;

import com.manli.api.base.exception.MyException;
import com.manli.api.dao.TestPrimaryDao;
import com.manli.api.dao.TestSecondDao;
import com.manli.api.enums.ResultEnums;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class TestPrimaryService {
	@Autowired
	TestSecondService secondService;
	@Autowired
	TestPrimaryDao testPrimaryDao;
	@Autowired
	TestSecondDao testSecondDao;
	
	public List<Map> test2() {
		return testPrimaryDao.execute("select * from user", null);
	}

	public Object test4() {
		// TODO Auto-generated method stub
		testPrimaryDao.executeUpdate("insert into user(id,name) values(?,?)", 2,"1大名");
		secondService.test4();
		throw new MyException(ResultEnums.UNKONW_ERROR);
		//return null;
	}
}
